package com.smartpro.mis.modular.business.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.smartpro.mis.modular.system.model.Orders;
import com.smartpro.mis.modular.system.model.Product;
import com.smartpro.mis.modular.system.dao.ProductMapper;
import com.smartpro.mis.modular.business.service.IProductService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 商品表 服务实现类
 * </p>
 *
 * @author mengiy
 * @since 2019-04-10
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {

    @Override
    public int insertID(Product product) {
       return  this.baseMapper.insert(product);
    }

    @Override
    public List<Map<String, Object>> getProductList(String beginTime, String endTime, Integer start, Integer num) {
        return this.baseMapper.getProductList(beginTime,endTime,start,num);
    }

    @Override
    public List<Map<String, Object>> getHomeProductList(String beginTime, String endTime, Integer onHomepage, Integer start, Integer num) {
        return  this.baseMapper.getHomeProductList(beginTime,endTime,onHomepage,start,num);
    }

    @Override
    public List<Product> selectListByPage(int start, int num) {
        // pageNum是页码，pageSize是该页码内包含的记录数
        Page pageBean = new Page<Product>(start, num);
        List<Product> productList = baseMapper.selectListByPage(pageBean,start,num);

        return productList;
    }
}
